#include <stdio.h>



// fault
struct list_item{
	struct list_item *pNext;
	int val;
}


struct list_item* (struct liist* pHead)
{
	if(!pHead)
		return NULL;

	struct list* pHeadTmp;
	while(pHead->pNext)
	{
		pHeadTmp = pHead->pNext;
		pHead->pNext = pHead;
		pHead = pHeadTmp;
	}

	return pHead;
}




// right
// HEAD -> NODE1 -> NODE2 
struct ListNode *reverseList(struct ListNode* head) {
	struct ListNode *newHead = NULL; // 最开始的newhead为NULL，合情合理
	struct ListNode *node;

	while (head != NULL) 
	{
		//1. 对之前的链表做头删
		node = head;
		head = head->next;
		
		//2. 对新链表做头插
		node->next = newHead; // old head
		newHead = node;
	}
	
	return newHead;
}

